home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / global-one-water.swf / scripts / __Packages / Queue.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  915 b   |  37 lines

  1. class Queue extends Array
  2. {
  3.    var path;
  4.    var joinedQueueHandler;
  5.    static var QUEUE_SEPARATION = 8;
  6.    function Queue(p, jqh)
  7.    {
  8.       super();
  9.       this.path = p;
  10.       this.joinedQueueHandler = jqh;
  11.    }
  12.    function joinedQueue(kid)
  13.    {
  14.       this.push(kid);
  15.       this.joinedQueueHandler();
  16.    }
  17.    function getKidAtFrontOfQueue()
  18.    {
  19.       var _loc2_ = this.shift();
  20.       this.kidLeaveQueue();
  21.       return _loc2_;
  22.    }
  23.    function kidLeaveQueue()
  24.    {
  25.       var _loc3_ = undefined;
  26.       var _loc4_ = undefined;
  27.       var _loc2_ = 0;
  28.       while(_loc2_ < this.length)
  29.       {
  30.          _loc3_ = this[_loc2_].distAlongPath;
  31.          _loc4_ = this.path.length - _loc2_ * Queue.QUEUE_SEPARATION;
  32.          this[_loc2_].followPath(this.path,Delegate.create(this[_loc2_].mc,this[_loc2_].mc.setPose,KidMc.IDLE),_loc4_,_loc3_);
  33.          _loc2_ = _loc2_ + 1;
  34.       }
  35.    }
  36. }
  37.